<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>responsaveis tecnicos</title>
<link type="text/css" rel="stylesheet" href="responsaveiscss.css" />
 <title>    
             Desenvolvido por Tenko            
        </title>
        <script>        
        var aAbas       = new Array();  // Lista de abas do documento atual
        var sAbaAtiva   = ""                 // Define qual é a aba ativa no momento
        var ABA_ID      = 1
        var ABA_BLOCO   = 2
        var ABA_CAMPOS  = 3
        
        function defineAba( sId, sBloco ){
           var aAba  = new Array( ABA_CAMPOS );
           aAba[ ABA_ID    ]  = sId;
           aAba[ ABA_BLOCO ]  = sBloco;
           aAbas.push( aAba );
        }

        function defineAbaAtiva( sId ){
           trataCliqueAba( sId );
        }

        function trataMouseAba( oAba ){
           oAba.style.cursor  = "pointer";
        }

        function trataCliqueAba( sId ){
           for ( var iAba  = 0; iAba < aAbas.length; iAba++ ){
              var aAba  = aAbas[ iAba ];

              if   ( aAba[ ABA_ID ] == sId ) ativaAba( aAba );

              else                           inativaAba( aAba );
           }
        }

        function ativaAba( aAba ){
           var sAba       = aAba[ ABA_ID ];
           var oAba       = document.getElementById( sAba );
           mudaClasse( oAba, "abaativa" ); // Esse comando chama a classe css para fazer a troca

           var sBlocoAba  = aAba[ ABA_BLOCO ];
           var oBlocoAba  = document.getElementById( sBlocoAba );
           oBlocoAba.style.display  = "block";
        }

        function inativaAba( aAba ){
           var sAba       = aAba[ ABA_ID ];
           var oAba       = document.getElementById( sAba );
           mudaClasse( oAba, "abainativa" ); // Esse comando chama a classe css para fazer a troca

           var sBlocoAba  = aAba[ ABA_BLOCO ];
           var oBlocoAba  = document.getElementById( sBlocoAba );
           oBlocoAba.style.display  = "none";
        }
        
        function mudaClasse( oObjeto, sClasse ){
           oObjeto.className  = sClasse;
        }
        </script>
<script type="text/javascript" src="../classes/js/Busca_Registro.js"></script>
<script type="text/javascript" src="../classes/js/Busca_Registros.js"></script>
<script type="text/javascript" src="../classes/js/Registro.js"></script>
<script type="text/javascript" src="../classes/js/Registros.js"></script>

<script type="text/javascript" src="../classes/js/responsaveis.js"></script>
<script type="text/javascript" src="../js/funcoes.js"></script>

<script type="text/javascript">  
 
         newresponsavel=new responsavel();
         
        function exibe_campos(){
                codigo_responsavel=document.forms[1].elements['CODIGO_RESPONSAVEL'].value;
                document.forms[1].reset();
                //newmaquina.setValores(newregistro.getValores());
                                
                if (acao=='I'){
                    document.forms[1].elements["CODIGO_RESPONSAVEL"].value = codigo_responsavel;
                }
                if (acao=='A'){
                        
                        document.forms[1].elements["CODIGO_RESPONSAVEL"].value = new String(newresponsavel.get_Codigo_Responsavel());
                        document.forms[1].elements["NOME_RESPONSAVEL"].value = new String(newresponsavel.get_Nome_Responsavel());
                        document.forms[1].elements["CPF"].value = new String(newresponsavel.get_CPF());
			document.forms[1].elements["RG"].value = new String(newresponsavel.get_RG());
                        document.forms[1].elements["DATA_NASCIMENTO"].value = new String(newresponsavel.get_Data_Nascimento());
                        document.forms[1].elements["DATA_ADMISSAO"].value = new String(newresponsavel.get_Data_Admissao());
                        document.forms[1].elements["FUNCAO"].value = new String(newresponsavel.get_Funcao());    
                        document.forms[1].elements["SETOR"].value = new String(newresponsavel.get_Profissao());
                        document.forms[1].elements["PROFISSAO"].value = new String(newresponsavel.get_Vida_Util2());
                        document.forms[1].elements["CARGO"].value = new String(newresponsavel.get_Cargo());
                        document.forms[3].elements["txt_log_data_cadastro"].value = new String(newresponsavel.get_Data_Cadastro());                
                        document.forms[3].elements["txt_log_ultima_atualizacao"].value = new String(newresponsavel.get_Ultima_Atualizacao());                     
                        document.forms[3].elements["txt_log_ultimo_usuario"].value = new String(newresponsavel.get_Ultimo_Usuario());                
                        
                       
                }
            }
            function carrega_campo(){
                 codigo_cnae=document.forms[1].elements['CODIGO_CNAE'].value;
                 cnae=Array();
                 descricao=Array();
                 observacao=Array();
                 var xtemp='';
                 var x='';
                 nregistros=newregistros.getValores();
                 for(i=0;i < nregistros.length;i++){
                    x=nregistros[i].split("|");
                    cnae[i]=x[0].substr(0,10);
                    xtemp=x[1];
                    descricao[i]=xtemp;

                 }
                 for (c=0;c<document.forms[1].elements['CODIGO_CNAE'].options.length-1;c++){
                     document.forms[1].elements['CODIGO_CNAE'].remove(c);
                 }
                 
                 
                 for (y=0;y<cnae.length;y++){
                             
                             //opt=document.createElement('option');
                             opt=new Option('Selecione um item',0);
                             if (y==0){
                                opt.text="Selecione um ítem";
                                opt.value="";
                             }
                             else {
                                opt.text=cnae[y]+" "+descricao[y];
                                opt.value=cnae[y];
                             }
                             
                             document.forms[1].elements['CODIGO_CNAE'].add(opt);
                        }
                        document.forms[1].elements['CODIGO_CNAE'].value=newresponsavel.get_CNAE();

            }
           

            
            var acao='';
            function grava_registro(){
             if (confirm("confirma o registro")){

                document.forms[1].action="../PHP/Responsavel_Class.php?acao=I";
                document.forms[1].submit();
             }
            }
            function apaga_registro(){
                if (confirm("Confirma a exclusão do registro?")){
                    document.forms[1].action="../PHP/Responsavel_Class.php?acao="+"D";
                    document.forms[1].submit();
                }
            }
            function proximo_registro(campo,visao){
                codemp=campo.value==''?0:campo.value;
                buscar_registro(window,campo.name,codemp,">",visao,newresponsavel);                    
                exibe_campos();
            }
            function registro_anterior(campo,visao){
                codemp=campo.value==''?0:campo.value;
                buscar_registro(window,campo.name, codemp,"<",visao,newresponsavel);
                exibe_campos();
            }  
         </script>
        <link href="estilosistema.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="titulo">
Cadastro de Responsaveis Tecnicos
</div>

<div id="menu">
  <form id="frm_barra_tarefas" action="" >
       <button type="button" onclick="">
       <table>
            <tr>
            <td height="42"><img src="../images/novo.png" height="40" width="38" /></td>
            </tr>
            <tr>
            <td height="16">Novo</td>
            </tr>
       </table>
       </button>
       <button type="button" onclick="grava_registro();">
       <table>
            <tr>
            <td height="42"><img src="../images/barra_ferramentas/floppy.png" height="40" width="45" /></td>
            </tr>
            <tr>
            <td height="16">Gravar</td>
            </tr>
       </table>
       </button>
       <button  type="button" onclick="apaga_registro();">
       <table>
            <tr>
            <td height="42"><img src="../images/barra_ferramentas/error_button_2.png" height="40" width="45" /></td>
            </tr>
            <tr>
            <td height="16">Apagar</td>
            </tr>
       </table>
       </button>
       <button  type="button" onclick="descer();">
       <table>
            <tr>
            <td height="42"><img src="../images/barra_ferramentas/update_quantity_cart[1].png" height="33" width="47" /></td>
            </tr>
            <tr>
            <td height="16">Desfazer</td>
            </tr>
       </table>
       </button>
       <button  type="button" onclick="subir();">
       <table>
            <tr>
            <td height="42"><img src="../images/barra_ferramentas/cima.gif" height="35" width="35" /></td>
            </tr>
            <tr>
            <td height="16">Primeiro</td>
            </tr>
      </table>
      </button>
      <button  type="button" onclick="registro_anterior(document.forms[1].elements['CODIGO_ATIVIDADE'],'atividades')">
      <table>
           <tr>
           <td height="42"><img src="../images/barra_ferramentas/left.png" height="35" width="45" /></td>
           </tr>
           <tr>
           <td height="16">Anterior</td>
           </tr>
      </table>
      </button>
      <button  type="button" onclick="proximo_registro(document.forms[1].elements['CODIGO_ATIVIDADE'],'atividades')">
      <table>
           <tr>
           <td height="42"><img src="../images/barra_ferramentas/right.png" height="35" width="45" /></td>
           </tr>
           <tr>
           <td height="16">Pr&oacute;ximo</td>
           </tr>
      </table>
      </button>
      <button  type="button" onclick="descer();">
     <table>
          <tr>
          <td height="42" width="48"><img src="../images/barra_ferramentas/baixo.gif" height="35" width="35" /></td>
          </tr>
          <tr>
          <td height="16">Ultimo</td>
          </tr>
     </table>
     </button>
     <button  type="button" onclick="imprime();">
     <table>
          <tr>
          <td height="42"><img src="../images/printer_2.png" height="40" width="40" /></td>
          </tr>
          <tr>
          <td height="18">Imprimir</td>
          </tr>
     </table>
     </button>
     <button  type="button" onclick="document.forms[1].reset();document.forms[1].elements['CODIGO_ATIVIDADE'].focus();">
     <table>
         <tr>
         <td height="42" width="50"><img src="../images/folha.gif" height="40" width="35" /></td>
         </tr>
         <tr>
         <td height="16">Limpar</td>
         </tr>
     </table>
  </button>  
</form>
</div>
<br />
<br />
   <div id="conteudo"> 
   <div id="abas">
    <table border="0" cellpadding="0" cellspacing="1">
            <tr>
                <td width="10%" height="36" align="center" valign="middle" class="abaativa" id="celAbaCadastro" onClick="trataCliqueAba( this.id );" onMouseOver="trataMouseAba( this );">
                    Cadastro      
                </td>
            </tr>
    </table>
      </div>

        <div id="divCadastro" style="display: block">
            <form id="frm_responsaveis"         name="frm_responsaveis" method="POST">
<table class="tabela2">
<tr>
<td>Codigo
<input type="text" name="CODIGO_RESPONSAVEL" size="10" onblur="buscar_registro(window,this.name,this.value,'=','responsaveis','responsaveis','Busca_Responsavel',true,newresponsavel)"/>
</td>
<td>Nome do Funcionario
<input type="text" name="NOME_RESPONSAVEL" size="20%" />
</td>
<td>Numero do CPF
<input type="text" name="CPF" size=""  />
</td>
</tr>
<tr>
<td>Numero do RG        
  <input type="text" name="RG"  size=""/>
</td>
<td>Data de Nascimento
<input type="text" name="DATA_NASCIMENTO" size="" />
</td>
<td>Data da Adimissão
<input type="text" name="DATA_ADMISSAO" size="" />
</td>
</tr>
</table>

<table class="tabela">
<tr>
<td>Profissão do Funcionario
<select NAME="PROFISSAO">
	<option></option>
    </select>
</td>
<td>Cargo Atual
<select NAME="CARGO">
</select>
</td>
<td>Setor De Trabalho
<select NAME="SETOR">
</select>
</td>
<td>Função
<select NAME="FUNCAO">
</select>
</td>
</tr>
</table>
            

</form>
        </div>
       
        <script>
            defineAba( "celAbaCadastro"  , "divCadastro"   );
            
            defineAbaAtiva( "celAbaCadastro" );
        </script>


</body>
</html>
